import java.awt.event.ActionEvent;

import javax.swing.JButton;


public class Encounter extends RandomEvent {
	
	JButton fight, detour;
	
	
	public Encounter(MainCardPanel display, Party p) {
		super(display, p);
		imageFilename = "encounter.jpg";
		fight = new JButton("Attack");
		detour = new JButton("Sneak around");
		fight.addActionListener(this);
		detour.addActionListener(this);
		displayName = "Enemy Spotted" ;
		fresh = true;
	}

	@Override
	public void decay() {
		display.showRandomEventPanel(this);
		dead = true;
		return;
	}

	@Override
	public JButton[] getResponseElements() {
		JButton[] ret = {fight, detour};
		return ret;
	}
	
	@Override
	public void actionPerformed(ActionEvent e)
	{
		super.actionPerformed(e);
		if (e.getSource()==fight)
			display.showMinigame();
		else if (e.getSource() == detour)
			p.detour();
			
	}
	
	
	
}
